package com.zgjkhis.modules.system.domain;

import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.bean.copier.CopyOptions;
import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import javax.validation.constraints.Pattern;
import java.io.Serializable;
import java.util.Date;

/**
 * @Author yzq
 * @Description 供应商
 * @Date 2021/6/23 9:38
 * @Param
 * @return
 **/
@Data
@TableName("his_prescription_order_address")
public class OrderAddress implements Serializable {

    @TableId
    private Long id;
    @ApiModelProperty(value = "联系人")
    private String username;
    @ApiModelProperty(value = "手机号")
    @Pattern(regexp = "^\\d{11}$",message = "请输入11位数字手机号")
    private String phone;
    @ApiModelProperty(value = "省")
    private String province;
    @ApiModelProperty(value = "省行政编码")
    private String provinceCode;
    @ApiModelProperty(value = "市")
    private String city;
    @ApiModelProperty(value = "市行政编码")
    private String cityCode;
    @ApiModelProperty(value = "区")
    private String area;
    @ApiModelProperty(value = "区行政编码")
    private String areaCode;
    @ApiModelProperty(value = "详情地址")
    private String address;
    @ApiModelProperty(value = "订单号")
    private String orderNo;

    /** 创建时间 */
    @TableField(fill= FieldFill.INSERT)
    @ApiModelProperty(value = "创建时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8")
    private Date createTime;

    @ApiModelProperty(value = "药房id")
    private String pharmacyId;

    public void copy(OrderAddress source){
        BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
    }
}
